package com.briup.web.controller;

import com.briup.response.Result;
import com.briup.service.UploadService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author by ca
 * @date 2024-11-05  16:03
 */
@Api(tags = "文件上传")
@RestController
public class UploadController {

    @Autowired
    private UploadService uploadService;

    @ApiOperation("上传图片")
    @PostMapping("upload")
    public Result<String> upload(@RequestPart MultipartFile img) {
        String url = uploadService.upload(img);
        return Result.success(url);
    }
}
